package cn.zzuli.securitydemo1.controller;

import org.springframework.security.access.annotation.Secured;
import org.springframework.web.bind.annotation.*;

/**
 * @Date: 2020/12/27 13:07
 * @Author: 绯色下午茶
 * @Description:
 */
@RestController
@RequestMapping("/security")
public class TestController {
    @GetMapping("/hello")
    @ResponseBody
    public String hello(){
        return "hello security";
    }

    @GetMapping("/index")
    @ResponseBody
    public String index(){
        return "hello index";
    }


    @GetMapping("/admin")
    @ResponseBody
    public String admin(){
        return "hello admin";
    }

    @GetMapping("/anyAdmin")
    @ResponseBody
    public String anyAdmin(){
        return "hello anyAdmin";
    }

    @GetMapping("/consumer")
    @ResponseBody
    public String consumer(){
        return "hello consumer";
    }

    @Secured({"ROLE_consumer","ROLE_admin"})
    @GetMapping("/testSE")
    public String testSecurity(){
        return "测试注解开启";
    }
}
